<template>
  <div id="app">
    <v-header :seller="seller"></v-header>
    <div class="tab">
      <div class="tab-wrapper">
        <router-link to="/">商品</router-link>
      </div>
      <div class="tab-wrapper">
        <router-link to="/comment">评论</router-link>
      </div>
      <div class="tab-wrapper">
        <router-link to="/seller">商家</router-link>
      </div>
    </div>
    <router-view :seller="seller"></router-view>
  </div>
</template>
<script>
import { getSeller } from "@/api";
import VHeader from "./components/v-header/v-header.vue";
export default {
  // 写成函数是因为只有函数有作用域，如果直接用对象的话，多个组件的data会产生冲突
  data() {
    return {
      seller: {},
    };
  },
  components: {
    VHeader,
  },
  created() {
    getSeller().then((res) => {
      console.log(res);
      this.seller = res;
    });
  },
};
</script>

<style lang="less">
* {
  margin: 0;
  padding: 0;
  text-decoration: none;
}
ul li {
  list-style: none;
}
.tab {
  display: flex;
  height: 36px;
  line-height: 36px;
  // align-content: center;
  .tab-wrapper {
    flex: 1;
    text-align: center;
  }
  a {
    display: inline-block;
    width: 100%;
    color: #666;
  }
  .router-link-exact-active {
    color: #f01414;
    border-bottom: 2px solid #f01414;
  }
}
</style>
